using System.Collections;
using UnityEngine;

public class ButSelectWeapon : MonoBehaviour
{
	public string nameWeapon;

	public UITexture texWeapon;

	public void SetInfoButton(BaseWeapon curWeapon)
	{
		nameWeapon = curWeapon.name;
		StartCoroutine(LoadAndAddTexture(curWeapon));
	}

	public IEnumerator LoadAndAddTexture(BaseWeapon curWeapon)
	{
		ResourceRequest newTexture = Resources.LoadAsync<Texture>("AtlasGame/" + curWeapon.nameSpritePreview);
		yield return newTexture;
		texWeapon.mainTexture = newTexture.asset as Texture2D;
	}
}
